<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :saveAuthName="saveAuthName"
                :exportApiName="exportApiName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>

<script>
import AddOrUpdate from './boxleave-add-or-update'
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'

export default {
  mixins: [basicMixins],
  data() {
    return {
      searchAttrs: {
        boxInfoId: {
          type: 'autoComplete',
          placeholder:'纸箱编号',
          querySearchApiName: 'boxApi/getBoxNoList'
        },
        dateTimeRange:{
          type: 'date',
          dateType: 'daterange',
          clearable: true
        }
      },
      primaryKey: 'id',
      listApiName: 'boxApi/listBoxLeaveList',
      deleteApiName: 'boxApi/deleteBoxLeave',
      exportApiName: 'boxApi/getBoxLeaveExport',
      saveAuthName: 'box:boxleave:save',
      deleteAuthName: 'box:boxleave:delete',
      showAttrs: {
        boxNo: {label: '纸箱编号'},
        boxNumber: {label: '出库数量', type: 'tag'},
        leaveType: {
          label: '出库类别',
          type: 'radio',
          items: [
            {value: 0, text: '自用'},
            {value: 1, text: '客户拉走', tagType: 'danger'}
          ]
        },
        clientGoAddress: {label: '出库去向'},
        dayTime: {
          label: '日期',
          type: 'date'
        },
        createUser: {label: '创建人员'},
        status: {
          label: '状态',
          type: 'radio',
          items: [
            {value: 0, text: '禁用', tagType: 'danger'},
            {value: 1, text: '正常'}
          ]
        }
      }
    }
  },
  components: {
    AddOrUpdate,
    tableView
  }
}
</script>
